<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="<?php echo $this->_webroot('skin/css/admin.css'); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo $this->_webroot('skin/css/main.css'); ?>">

<script language="JavaScript" src="<?php echo $this->_webroot('skin/js/jy.js'); ?>"></script>
<script type='text/javascript' src='<?php echo $this->_webroot('servtools/date/WdatePicker.js'); ?>'></script>
<style>
td span {color:red;}
.green {color:green;}
.red {color:red;}
</style>
</head>
<body>
<input type="hidden" id="update_right" value="1" ></input>
<div id="maincontent">
<psp:tags     htmlname='messagebox'  iconname='messagebox' />
	<div class="wrap">
    <div class="crumbs">当前位置 &gt;&gt; 商品管理 &gt;&gt; 商品列表</div>
        <hr />
		<div class="seachbox">
			<div class="content2">
        	<form action="m.php?app=goods_list" name="searchForm" method="get">
				<table class="form_table">
				  <tbody>
				  	<tr>
				  		<td width="20px">
							<img src="<?php echo $this->_webroot('skin/images/icon_search.gif'); ?>" border="0" alt="SEARCH" />

						</td>
						<td width="180px">
							<span style="margin:1px 0px 0px 0px; float:left; color: #000" >
								商品名称:
							</span>
							<input class="small-text" type="text" name="name" value="<?php echo $name; ?>" />
						</td>
					   <!-- <td width="50px">
					    	精品<input type="checkbox" name="best" value="1" <?php if($best) echo "checked";?> />
						</td>
						<td width="50px">
							新品<input type="checkbox" name="new" value="1" <?php if($new) echo "checked";?> />
						</td>
						<td width="50px">
							热销<input type="checkbox" name="hot" value="1" <?php if($hot) echo "checked";?> />
						</td>
						<td width="50px">
							特价<input type="checkbox" name="promote" value="1" <?php if($promote) echo "checked";?> />
						</td>-->
						<td width="80px">
							热卖特价<input type="checkbox" name="admin_promote" value="1" <?php if($admin_promote) echo "checked";?> />
						</td>
						<td width="50px">
						上架<input type="checkbox" name="sale" value="1" <?php if($sale) echo "checked";?> />
							<input type="hidden" name="app" value="goods_list" />
						</td>
						<td>
							<input class="regular-button" type="submit" value="搜索" />
						</td>
				    </tr>
				  </tbody>
				</table>
            </form>
			</div>
		</div>		
		
		
	<div class="infobox">
    <h3>商品列表</h3>
    <div class="content2">
		<form action="a.php?act=lock_goods" name="form1" method="post">
		<table class="list_table">
		  <thead>
            <tr style="text-align: center;">
				<th width="2px"><input type="checkbox" value="" onclick="checkall(this,'goods_id[]');"></th>
				<th width="20px">ID</th>
				<th width="" align="left">商品名称</th>
				<th width="80px">商品价格</th>
				<th width="60px">运费</th>
				<th width="60px">库存</th>
				<th width="35px">上架</th>
				<!--
				<th width="35px">精品</th>
				<th width="35px">新品</th>
				<th width="35px">热销</th>
				<th width="35px">特价</th>-->
				<th width="35px">热卖特价</th>
				<th width="45px">关注度</th>
				<th width="90px">添加时间</th>
				<th width="40px">操作</th>
			</tr>
			</thead>
			<tbody>
			<?php if($result['data']) {
			foreach($result['data'] as $value) { $value = $value['goods']; ?>
			<tr style="text-align: center;">
				<td width="2px"><input type="checkbox" name="goods_id[]" value="<?php echo $value['id'];?>" /></td>
				<td width="20px"><?php echo $value['id'];?>.</td>
				<td style=" text-align:left;" width=""><a href="../goods.php?id=<?php echo $value['id'];?>" target="_blank"><?php echo $value['goods_name'];?></a></td>
				<td style=" text-align:center;" width="80px"><?php echo $value['goods_price'];?></td>
				<td style=" text-align:center;" width="60px"><?php echo $value['transport_price'];?></td>
				<td style=" text-align:center;" width="60px"><?php echo $value['goods_number'];?></td>
				<td style=" text-align:center;" width="35px">
					<?php if($value['is_on_sale']) { ?><img src="<?php echo $this->_webroot('skin/images/yes.gif'); ?>" onclick="toggle_show(this,'on_sale','<?php echo $value['id']; ?>')"/><?php } else { ?><img src="<?php echo $this->_webroot('skin/images/no.gif'); ?>" onclick="toggle_show(this,'on_sale','<?php echo $value['id']; ?>')" /><?php } ?>
				</td>
				<!--<td style=" text-align:center;" width="35px">
					<?php if($value['is_best']) { ?><img src="<?php echo $this->_webroot('skin/images/yes.gif'); ?>" onclick="toggle_show(this,'best','<?php echo $value['id']; ?>')" /><?php } else { ?><img src="<?php echo $this->_webroot('skin/images/no.gif'); ?>" onclick="toggle_show(this,'best','<?php echo $value['id']; ?>')" /><?php } ?>
				</td>
				<td style=" text-align:center;" width="35px">
					<?php if($value['is_new']) { ?>
					<img src="<?php echo $this->_webroot('skin/images/yes.gif'); ?>" onclick="toggle_show(this,'new','<?php echo $value['id']; ?>')" />
					<?php } else { ?><img src="<?php echo $this->_webroot('skin/images/no.gif'); ?>" onclick="toggle_show(this,'new','<?php echo $value['id']; ?>')" /><?php } ?>
				</td>
				<td style=" text-align:center;" width="35px">
					<?php if($value['is_hot']) { ?><img src="<?php echo $this->_webroot('skin/images/yes.gif'); ?>" onclick="toggle_show(this,'hot','<?php echo $value['id']; ?>')" /><?php } else { ?><img src="<?php echo $this->_webroot('skin/images/no.gif'); ?>" onclick="toggle_show(this,'hot','<?php echo $value['id']; ?>')" /><?php } ?>
				</td>
				<td style=" text-align:center;" width="35px">
					<?php if($value['is_promote']) { ?><img src="<?php echo $this->_webroot('skin/images/yes.gif'); ?>" onclick="toggle_show(this,'promote','<?php echo $value['id']; ?>')" /><?php } else { ?><img src="<?php echo $this->_webroot('skin/images/no.gif'); ?>" onclick="toggle_show(this,'promote','<?php echo $value['id']; ?>')" /><?php } ?>
				</td>-->
				<td style=" text-align:center;" width="70px">
					<?php if($value['is_admin_promote']) { ?><img src="<?php echo $this->_webroot('skin/images/yes.gif'); ?>" onclick="toggle_show(this,'admin_promote','<?php echo $value['id']; ?>')" /><?php } else { ?><img src="<?php echo $this->_webroot('skin/images/no.gif'); ?>" onclick="toggle_show(this,'admin_promote','<?php echo $value['id']; ?>')" /><?php } ?>
				</td>
				<td style=" text-align:center;" width="68px"><?php echo $value['pv'];?></td>
				<td style=" text-align:center;" width="90px"><?php echo substr($value['add_time'],0,10);?></td>
				<td style=" text-align:center;" width="40px">
					<a href="<?php echo $this->_url('admin/goods/edit/'.$value['id']);?>">修改</a><br />
					<?php if($right_array['goods_look']){?>
					<a href="../goods.php?id=<?php echo $value['id'];?>" target="_blank">查看</a><br />
					<?php }?>
					<?php if($value['lock_flg']==0){?>
					<a href="<?php echo $this->_url('admin/goods/lockgoods');?>?id=<?php echo $value['id']; ?>&v=1" onclick="return confirm('确定要执行此操作吗？')">锁定</a><br />
					<?php }else{?>
					<a href="<?php echo $this->_url('admin/goods/lockgoods');?>?id=<?php echo $value['id']; ?>&v=0" >解除锁定</a>
					<?php }?>
					</td>
			</tr>
			<?php }?>
			<tr>
				<td colspan="15">
					<span style="margin:14px 14px 0px 0px; float:left;" >
						<select name="v">
							<option value="1">锁定</option>
							<option value="0">解除锁定</option>
						</select>
					</span>
					<span class="button-container"><input class="regular-button" type="submit" name=""  onclick="return delcheck();" value="批量操作" /></span>
				</td>
			</tr>
			<?php } else { ?>
			<tr>
				<td colspan="13">暂无信息</td>
			</tr>
			<?php } ?>
                            <tr>
								<td class="center" colspan="10">
                            <a href="<?php echo $result['page']['head'];?>">首页</a> 
                            <a href="<?php echo $result['page']['prevPage'];?>">上一页</a> 
                            <?php foreach($result['page']['plist'] as $k => $v ) { ?>							
                            <a href="<?php echo $v; ?>"><?php echo $k; ?></a>
							<?php } ?>
                            <a href="<?php echo $result['page']['nextPage'];?>">下一页</a> 
                            <a href="<?php echo $result['page']['foot'];?>">尾页</a> 
                            当前第<?php echo $result['page']['current']['num'];?>页/共<?php echo $result['page']['pageCount'];?>页</td>
							</tr>
			</tbody>
		</table>
		</form>
		
		
	  </div>
	 </div>
	</div>
</div>
<script language="JavaScript" src="<?php echo $this->_webroot('servtools/ajax_client/ajax.js'); ?>"></script>
<script language="JavaScript">
<!--
var inputs = document.getElementsByTagName("input");

function toggle_show(obj,name,id) {
		var re = /yes/i;
		//alert(re);
		var src = obj.src;
		var s = 1;
		var searchv = src.search(re);
		if(searchv > 0) {
			s = 0;
		}
		//alert(s);
		ajax("a.php?act=goods_toggle","POST","id="+id+"&s="+s+"&name="+name,function(data){
			if(data) {
				obj.src = '../skin/default/images/'+data+'.gif';
			}
		});

function delcheck(){
	var checked = false; 
    for (var i = 0; i < inputs.length; i++) 
    { 
    	if (inputs[i].checked == true) 
        {
            checked = true;
            if(confirm('确定要执行此操作吗？')){
            	break; 
                }else{
                	return false;
                	break; 
                    }
        }
    } 
    if (!checked) 
    { 
        ShowMessageBox("请至少选择一个商品！",'0'); 
        return false; 
    }
    return true;
}
//-->
</script>

</body>
</html>